﻿using System;
using System.Collections;
using System.Collections.Specialized;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Common.Core.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Testing.Core;

namespace Common.Core.Testing
{
	/// <summary>
	/// Summary description for NamedTokenFormatterTests
	/// </summary>
	[TestClass]
	public class NamedTokenFormatterTests : TestBase
	{
		[TestMethod]
		public void VerifyBasicValueReplacesCorrectlyFromObject()
		{
			string result = string.Format( new NamedTokenFormatter(), "My name is {0:Name}.", new { Name = "Bob" } );
			Assert.AreEqual( "My name is Bob.", result );
		}

		[TestMethod]
		public void VerifyBasicValueReplacesCorrectlyFromDictionary()
		{
			ListDictionary dictionary = new ListDictionary();
			dictionary.Add( "Name", "Harry" );
			string result = string.Format( new NamedTokenFormatter(), "My name is {0:Name}.", dictionary );
			Assert.AreEqual( "My name is Harry.", result );
		}
	}
}
